/*
// Exepack.NET
// http://www.codeplex.com/exepack
//
// Inflate utility
// Written by Y [10-01-09]
// Copyright (c) 2008-2010 Alexey Yakovlev
*/

using System;
using System.IO;
using System.IO.Compression;

class Inflater
{
	static void Main(string[] args)
	{
		if (args.Length != 2)
		{
			Console.WriteLine("syntax: inflate infile outfile");
			return;
		}

		using (FileStream inFile = File.OpenRead(args[0]))
		{
			int length = new BinaryReader(inFile).ReadInt32();

			using (FileStream outFile = File.Create(args[1]))
			using (DeflateStream ds = new DeflateStream(inFile, CompressionMode.Decompress))
			{
				new BinaryWriter(outFile).Write(new BinaryReader(ds).ReadBytes(length));
			}
		}
	}
}

